/**
 * Created by justao on 7/3/14.
 */

'use strict';

import React, {
  Component,
  StyleSheet,
  ScrollView,
  RefreshControl
} from 'react-native';

import MeItem from './MeItem';
import {
    WelcomeAction,
    HistoryAction,
    ContactsAction,
    SettingAction,
    FeedbackAction
} from './actions'

const ITEMS_CONFIG = [
  {
    key: 'account',
    lable: '注册、登录',
    action: WelcomeAction,
  },
  {
    key: 'history',
    lable: '以往活动',
    action: HistoryAction,
  },
  {
    key: 'contacts',
    lable: '好友',
    action: ContactsAction,
  },
  {
    key: 'setting',
    lable: '个性化',
    action: SettingAction,
  },
  {
    key: 'feedback',
    lable: '吐槽、建议',
    action: FeedbackAction,
  },
];

export default class MePage extends React.Component {
  render() {
    return (
        <ScrollView style={styles.scrollView}>
        {ITEMS_CONFIG.map(item =>{
          return (
          <MeItem key={item.key}
              text={item.lable}
              onPress={() => {
              this.props.onNavigate(item.action());
            }}
          />);
        })}
        </ScrollView>
    );
  }
}

const styles = StyleSheet.create({
  scrollView: {
    marginTop: 64
  },
});

/**
 * 
                    refreshControl={
          <RefreshControl
            refreshing={false}
            onRefresh={this._onRefresh}
            tintColor="#0000ff"
            title="Loading..."
            colors={['#0000ff']}
          />
        }
 */